package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.FVoucher1;
import com.ruoyi.system.service.IFVoucher1Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 财务结算管理Controller
 * 
 * @author qi
 * @date 2024-05-08
 */
@RestController
@RequestMapping("/system/voucher1")
public class FVoucher1Controller extends BaseController
{
    @Autowired
    private IFVoucher1Service fVoucher1Service;

    /**
     * 查询财务结算管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:list')")
    @GetMapping("/list")
    public TableDataInfo list(FVoucher1 fVoucher1)
    {
        startPage();
        List<FVoucher1> list = fVoucher1Service.selectFVoucher1List(fVoucher1);
        return getDataTable(list);
    }

    /**
     * 导出财务结算管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:export')")
    @Log(title = "财务结算管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FVoucher1 fVoucher1)
    {
        List<FVoucher1> list = fVoucher1Service.selectFVoucher1List(fVoucher1);
        ExcelUtil<FVoucher1> util = new ExcelUtil<FVoucher1>(FVoucher1.class);
        util.exportExcel(response, list, "财务结算管理数据");
    }

    /**
     * 获取财务结算管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:query')")
    @GetMapping(value = "/{fVoucherid1}")
    public AjaxResult getInfo(@PathVariable("fVoucherid1") Long fVoucherid1)
    {
        return success(fVoucher1Service.selectFVoucher1ByFVoucherid1(fVoucherid1));
    }

    /**
     * 新增财务结算管理
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:add')")
    @Log(title = "财务结算管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FVoucher1 fVoucher1)
    {
        return toAjax(fVoucher1Service.insertFVoucher1(fVoucher1));
    }

    /**
     * 修改财务结算管理
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:edit')")
    @Log(title = "财务结算管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FVoucher1 fVoucher1)
    {
        return toAjax(fVoucher1Service.updateFVoucher1(fVoucher1));
    }

    /**
     * 删除财务结算管理
     */
    @PreAuthorize("@ss.hasPermi('system:voucher1:remove')")
    @Log(title = "财务结算管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fVoucherid1s}")
    public AjaxResult remove(@PathVariable Long[] fVoucherid1s)
    {
        return toAjax(fVoucher1Service.deleteFVoucher1ByFVoucherid1s(fVoucherid1s));
    }
}
